﻿using BaseAuthRole.Domain.Input;
using BaseAuthRole.Domain.OutPut;
using BaseAuthRole.DTO.Knowledge;
using BaseAuthRole.DTO.Org;
using BaseAuthRole.DTO.Role;
using BaseAuthRole.DTO.User;
using RS.BaseModel;
using RS.BaseModel.Common;
using RS.BaseModel.Enum;

namespace BaseAuthRole.IService
{
    public interface IUserService
    {
        CommonResult GetUserAuthCode(string appid, string uid, string authType,string redirect_uri);
        CommonResult<BaseUserLoginModel> Login(string LoginName, string PassWord, string CodeToken, string VerifyCode);

        CommonResult<GetUserAuthTokenOutput> GetUserAuthToken(string appid,string code);

        CommonResult GetUserInfo(string token, string appid);
        CommonResult<GetAppAccessTokenModelOutPut> GetAppAccessTokenModel(string appid, string secret);
        CommonResult<GetUserInfoOutPut> GetUserInfo(GetUserInfoInput getUserInfoInput);

        CommonResult<GetUserDetailInfoOutPut> GetUserDetailInfo(GetUserInfoInput getUserInfoInput);

        CommonResult<GetUserInfoOutPut> GetUserInfoByUid(GetUserInfoByUidInput input);


        CommonResult<GetUserInfoOutPut> GetUserInfoByJobNumber(GetUserInfoByJobNumberInput input);

        CommonResult<GetUserInfoOutPut> GetUserInfoByLoginName(GetUserInfoByLoginNameInput input);

        UUIUser GetUIUser(string id);
        UUIUser GetUIUser(string login_name, string password);

        UUIUser GetUIUser(object obj);
        bool CheckUserAction(string UserId, string ActionId);

        /// <summary>
        /// 获取验证码
        /// </summary>
        /// <returns></returns>
        Task<CommonResult<GetVerifyCodeOutPut>> GetVerifyCode();

        List<Role> GetCJWUserRoleRelation(string UserId);

        UUIUserAuthCode GetUUIUserAuthCode(string id);

        CommonResult<UUIUser> PublicAppAuthorizeCheck(string appid, string uid, string authType, string redirect_uri);
        CommonResult AccessTokenCheck(string appid, string accessToken);
        List<Role> GetRoles(int pagenum, int pagesize, string condition, string orderby, out long count, object para = null);

        /// <summary>
        /// 获取角色项目关联列表
        /// </summary>
        /// <param name="roleIds">角色Id列表s</param>
        /// <returns></returns>
        List<RoleProjectRelation> GetRoleProjectRelations(List<string> roleIds);

        /// <summary>
        /// 保存角色项目关联列表
        /// </summary>
        /// <param name="roleIds">角色Id列表s</param>
        /// <returns></returns>
        CommonResult SaveRoleProjectRelations(SaveRoleRelateProjectClientInput input);

        IEnumerable<UUIUser> GetUsers(int pagenum, int pagesize, string condition, string orderby, out long count, object para = null);

        CommonResult<GetUserInfoOutPut> GetUserInfo(string authToken);

        CommonResult<GetUserInfoOutPut> GetUserInfoByMobile(string mobile);

        CommonResult<PageModel<GetUserInfoOutPut>> GetUserInfoList(GetUserInfoListInput input);

        CommonResult<PageModel<GetSimpleUserInfoOutPut>> GetSimpleUserInfoList(GetUserInfoListInput input);

        /// <summary>
        /// 获取角色用户列表(客户端)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<PageModel<GetUserInfoClientOutPut>> GetRoleUserInfoList(GetRoleUserPageListClientInput input);

        /// <summary>
        /// 导出角色
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<ExportDocumentOutPut> ExportRole(ExportRoleClientInput input);

        /// <summary>
        /// 获取用户列表(客户端)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<PageModel<GetUserInfoClientOutPut>> GetUserInfoList(GetUserInfoListClientInput input);

        /// <summary>
        /// 添加角色用户
        /// </summary>
        /// <returns></returns>
        CommonResult AddRoleUser(AddRoleUserClientInput input);

        /// <summary>
        /// 删除角色用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult DelRoleUser(DelRoleUserClientInput input);

        /// <summary>
        /// 下载角色用户模板
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<ExportDocumentOutPut> DownloadRoleUserTemplate(DownloadRoleUserTemplateClientInput input);

        /// <summary>
        /// 导入角色用户
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult ImportRoleUser(ImportRoleUserClientInput input);

        /// <summary>
        /// 导入角色用户(项目)
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult ImportProjectRoleUser(ImportRoleUserClientInput input);

        /// <summary>
        /// 导出角色用户
        /// </summary>
        /// <returns></returns>
        CommonResult<ExportDocumentOutPut> ExportRoleUser(ExportRoleUserClientInput input);

        int UpdateUIUser(UUIUser model);

        int AddUUIUser(UUIUser model);

        CommonResult AddOrUpdateUser(List<AddOrUpdateUserInput> inputList);

        Role GetRole(string id);

        List<ActionGroup> GetActionGroup();

        int UpdateRoleAction(Role Role, List<string> Actions);

        int CreateRoleAction(Role Role, List<string> Actions);

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <returns></returns>
        CommonResult DelRole(string? roleId);

        List<string> GetRoleProject(string RoleId);

        List<string> GetRoleAction(string RoleId);

        int CreateUser(UUIUser user, List<string> Roles);

        int UpdateUserRole(UUIUser user, List<string> Roles);

        CommonResult UpdateFeishuId(UpdateFeishuIdInput input);

        CommonResult CancelAuthToken(CancelAuthTokenInput input);

        CommonResult UpdateKnowledgeReadAction(UpdateKnowledgeReadActionInput input);

        #region 组织
        CommonResult AddOrUpdateOrg(List<AddOrUpdateOrgInput> inputList);

        /// <summary>
        /// 获取组织列表
        /// </summary>
        /// <returns></returns>
        CommonResult<List<Organization>> GetOrgList();

        /// <summary>
        /// 获取组织树列表
        /// </summary>
        /// <returns></returns>
        CommonResult<List<OrgTreeOutPut>> GetOrgTreeList();

        /// <summary>
        /// 获取组织用户树列表
        /// </summary>
        /// <returns></returns>
        CommonResult<List<OrgUserTreeOutPut>> GetOrgUserTreeOutList(GetOrgUserTreeListInput input);

        /// <summary>
        /// 通过组织Id获取组织Id列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<List<string?>> GetOrgIdListByOrgId(GetOrgIdListByOrgIdInput input);
        /// <summary>
        /// 通过组织Id获取所有子组织Id列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public CommonResult<List<string?>> GetSubOrgIdListByOrgId(GetOrgIdListByOrgIdInput input);

        /// <summary>
        /// 获取全部简易组织信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<List<SimpleOrgOutput>> GetAllSimpleOrgList();

        /// <summary>
        /// 通过组织Id获取组织信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<OrgOutPut?> GetOrgInfoByOrgId(GetOrgInfoByOrgIdInput input);

        /// <summary>
        /// 通过组织Id列表获取组织列表信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        CommonResult<List<OrgOutPut>?> GetOrgInfosByOrgIds(GetOrgInfosByOrgIdsInput input);
        #endregion

        #region 知识类别权限
        KnowledgeAuth GetKnowledgeAuth(string id);

        int CheckKnowledgeAuth(KnowledgeAuth knowledgeAuth, string? exceptId = null);

        int UpdateKnowledgeAuth(KnowledgeAuth knowledgeAuth, List<string> relationActions);

        int CreateKnowledgeAuth(KnowledgeAuth knowledgeAuth, List<string> relationActions);

        List<KnowledgeAuth> GetKnowledgeAuths(int pagenum, int pagesize, string condition, string orderby, out long count, object para = null);

        List<string> GetKnowledgeAuthRelation(string KnowledgeAuthId);

        CommonResult<List<KnowledgeAuthOutPut>?> GetKnowledgeAuthInfoList(GetKnowledgeAuthInfoListInput input);
        int DeleteKnowledgeAuth(string id);

        #endregion

        #region 知识中心组织架构权限管理
        CommonResult AddKnowledgeAuthOrganization(AddKnowledgeAuthOrganizationInput input);
        CommonResult DeleteKnowledgeAuthOrganization(DeleteKnowledgeAuthOrganizationInput input);
        CommonResult<PageModel<GetKnowledgeAuthOrganizationListOut>> GetKnowledgeAuthOrganizationList(GetKnowledgeAuthOrganizationListInput input);
        CommonResult<GetKnowledgeAuthOrganizationApiListOut> GetKnowledgeAuthOrganizationApiList(GetKnowledgeAuthOrganizationApiListInput input);
        #endregion
        /// <summary>
        /// 添加用户访问记录
        /// </summary>
        /// <returns></returns>
        CommonResult AddUserVisitRecord(string ip, string uid);
        /// <summary>
        /// 添加用户模块访问记录
        /// </summary>
        /// <returns></returns>
        CommonResult AddUserModuleVisitRecord(string ip, string module, string uid);

    }
}